<template>
  <section class="street-video">
    <DivShell title="街道实景">
      <div class="container" v-if="videoList.length>0">
        <template v-if="!currentHandleclickVideo">
          <div v-for="(item,index) in videoList" :key="index">
            <video loop autoplay :src="item.url"></video>
          </div>
        </template>
        <template v-if="currentHandleclickVideo">
          <div class="big-video">
            <video :src="currentHandleclickVideo.url"></video>
          </div>
        </template>
      </div>
      <div class="container" v-if="videoList.length==0">
        <div>暂无视频</div>
        <div>暂无视频</div>
        <div>暂无视频</div>
        <div>暂无视频</div>
      </div>
    </DivShell>
  </section>
</template>

<script>
import { mapGetters } from 'vuex'
import DivShell from '@src/components/divShell.vue'
export default {
  name: "StreetVideo",
  components:{
    DivShell,
  },
  props: {
    title:{
      type: String,
      default:'丰图精准决策数字底板'
    }
  },
  computed: {
    ...mapGetters(['videoList','currentHandleclickVideo']),
  },
  data() {
    return {
      list:[
        {
          effect_id:'camera1',
          name:'视频1',
          url:require('../../../../public/video/1.webm')
        },
        {
          effect_id:'camera2',
          name:'视频2',
          url:require('../../../../public/video/2.webm')
        },
        {
          effect_id:'camera3',
          name:'视频3',
          url:require('../../../../public/video/3.webm')
        },
        {
          effect_id:'camera4',
          name:'视频4',
          url:require('../../../../public/video/4.webm')
        },
      ]
    };
  },
  mounted() {
    // 写死
    this.$store.commit('video/SET_VIDEOLIST',this.list);
  },
  methods: {
    
  },
  beforeDestroy() {
      
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
  .street-video{
    // margin-bottom: 18px;
    & .container{
      margin-right: -9px;
      margin-top: -12px;
      display: flex;
      flex-wrap: wrap;
      &>div{
        width: 185px;
        height: 90px;
        background: #47506E;
        margin-right: 10px;
        margin-bottom: 10px;
        overflow: hidden;
        line-height: 90px;
        text-align: center;
        color:#307FFF;
        &.big-video{
          width: 100%;
          height: 190px;
          margin-right: 0;
          margin-bottom: 0;
        }
        &>video{
          width: 100%;
          // height: 100%;
        }
        &:nth-of-type(2n){
          margin-right: 0;
        }
        &:nth-of-type(3){
          margin-bottom: 0;
        }
        &:nth-of-type(4){
          margin-bottom: 0;
        }
      }
    }
  }
</style>
